class Solution {
    public String reverseVowels(String s) {
        int n=s.length();
        char result[]=s.toCharArray();
        int i=0;int j=n-1;
        while(i<j)
        {
            while(i<n&&!isvalue(result[i]))
            i++;
            while(j>=0&&!isvalue(result[j]))
            j--;
            if(i<j)
            {
                swap(result,i,j);
                i++;
                j--;
            }
        }
        return new String(result);
    }
    public boolean isvalue(char ch)
    {
        if("aeiouAEIOU".indexOf(ch)>=0)
        return true;
        return false;
    }
    public void swap(char []arr,int a,int b)
    {
        char temp;
        temp=arr[b];
        arr[b]=arr[a];
        arr[a]=temp;
    }
}
